<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="jquery-1.7.1.js"></script>
<script type="text/javascript" src="jquery.cookie.js"></script>
<title>Insert title here</title>
<script language="javascript">

function popup(){
	var isPopup = false;
	window.onbeforeunload = function(){
		if (!isPopup && $.cookie('popup_done')!='done'){ 
			$.cookie('popup_done','done'); 
			showTips('popupWin');
			return "Message! \n\n Message!!!!! \n\n Message!!!!!!!!!!"; 
		} 
	};
	//showTips
	function showTips(id){
		if(id!=null && id!='' && $('#'+id)!=null){
			$('#'+id).show();
			isPopup = true;
		}
	};
	
}
//hidetips
function hideTips(id){
	if(id!=null && id!='' && $('#'+id)!=null){
		$('#'+id).hide(); 
	}
}

$(document).ready(function() {
	popup();
});

</script>
</head>
<body>
<div id="popupWin" style="display:none;">Pic  <a href="javascript:" onClick="hideTips('popupWin')">No,thanks</a>  |   <a href="#">Sure</a></div>

AAAAAAAAAA
</body>
</html>